package com.ynny.demo10;

import com.ynny.list01.ArrayLIst;

import java.sql.Array;
import java.util.ArrayList;
import java.util.List;

public class StudentTest {
    public static void main(String[] args) {
        ArrayList<Student> list = new ArrayList<>();

        list.add(new Student(1,"张三"));
        list.add(new Student(2,"李四"));
        list.add(new Student(3,"王五"));

        System.out.println(list);
        for (int i = 0; i < list.size(); i++) {
            Student student = list.get(i);
            if (student.getName().equals("张三")){
                student.setName("张三");
            }
            if(student.getName().equals("王五")){
                list.remove(student);
            }
        }
        System.out.println(list);
        }
    }

